home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXT Education Software Sampler 1992 Fall
/
NeXT Education Software Sampler 1992 Fall.iso
/
SoundAndMusic
/
cmix
/
lib
/
resonz.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-02-25
|
664b
|
39 lines
#include "../H/ugens.h"
rszset(cf,bw,xinit,a)
float cf,bw,xinit,*a;
{
double exp(),cos();
int i;
a[0]=exp(-PI*bw/SR);
a[1]=1.-a[0];
a[2]=2.*a[0]*cos(2.*PI*cf/SR);
a[3] = -a[0]*a[0];
if(!xinit) for(i=4; i<9; i++) a[i]=0.;
}
float resonz(sig,a)
float sig,*a;
{
float z;
z=a[1]*(sig-a[0]*a[4])+a[2]*a[5]+a[3]*a[6];
a[4]=a[8];
a[8]=sig;
a[6]=a[5];
a[5]=z;
return(z);
}
float bresonz(sig,a,out,count)
float *sig,*a,*out;
{
float z;
int i;
for(i=0; i<count; i++) {
z=a[1]*(sig[i]-a[0]*a[4])+a[2]*a[5]+a[3]*a[6];
a[4]=a[8];
a[8]=sig[i];
a[6]=a[5];
out[i] = a[5] = z;
}
}